/**
 * 
 */
package com.I9lou.se.lurker.remote;

import java.util.Arrays;

import org.apache.lucene.document.Document;

/**
 * {@link IndexSearcherService#search()}方法返回结果
 * @author chenwei
 * @date 2011-04-08
 * @UnThreadSafe
 */
public class SearchResult implements java.io.Serializable {

	private static final long serialVersionUID = -214173886549913050L;
	
	private boolean ignore = false;
	
	private int totalHits = 0;
	
	private Document[] docs;

    private float[] scores;
	
	public boolean isIgnore() {
		return ignore;
	}

	public SearchResult setIgnore(boolean ignore) {
		this.ignore = ignore;
		return this;
	}

	public int getTotalHits() {
		return totalHits;
	}

	public SearchResult setTotalHits(int totalHits) {
		this.totalHits = totalHits;
		return this;
	}

	public Document[] getDocs() {
		return docs;
	}

	public SearchResult setDocs(Document[] docs) {
		this.docs = docs;
		return this;
	}

    public float[] getScores() {
        return scores;
    }

    public void setScores(float[] scores) {
        this.scores = scores;
    }

    @Override
	public String toString() {
		StringBuilder buffer = new StringBuilder("SearchResult@{");
		buffer.append("ignore: \"").append( isIgnore() );
		buffer.append("\", totalHits: \"").append( getTotalHits() );
		buffer.append("\", docs: \"").append( Arrays.toString(docs) );
		return buffer.append("\"}").toString();
	}
	
}
